You mean an infinite-dimensional Hilbert space. The answer is no. Suppose $p(z)$ has distinct roots $\alpha_1, \alpha_2$. Define a sequence $x_1, x_2, \ldots$ in the unit sphere of $H$ such that 1. $x_1,\ldots, x_n$ are linearly independent for all $n$. 2. $\|x_i - x_{i+1}\| \to 0$ as $i \to \infty$. 3. the sequence is dense in the unit sphere of $H$. Define $A$ on the linear span of the sequence so that $A x_i = \alpha_1 x_i$ if $i$ is odd, $\alpha_2 x_i$ otherwise. On the other hand, if $p$ has only one root, say $p(z) = (z - \alpha)^d$, then with the same sequence as above take $A x_i = \alpha x_i + x_{i+1}$ for $i$ not divisible by $d$, $\alpha x_i$ otherwise.