The ratio between the prompt $\ensuremath{\psi}(2S)$ and $J/\ensuremath{\psi}$ yields, reconstructed via their decays into ${\ensuremath{\mu}}^{+}{\ensuremath{\mu}}^{\ensuremath{-}}$, is measured in Pb-Pb and $p$-$p$ collisions at $\sqrt{{s}_{NN}}=2.76\text{ }\text{ }\mathrm{TeV}$. The analysis is based on Pb-Pb and $p$-$p$ data samples collected by CMS at the Large Hadron Collider, corresponding to integrated luminosities of $150\text{ }\text{ }\ensuremath{\mu}{\mathrm{b}}^{\ensuremath{-}1}$ and $5.4\text{ }\text{ }{\mathrm{pb}}^{\ensuremath{-}1}$, respectively. The double ratio of measured yields $({N}_{\ensuremath{\psi}(2S)}/{N}_{J/\ensuremath{\psi}}{)}_{\mathrm{Pb}\text{\ensuremath{-}}\mathrm{Pb}}/\phantom{\rule{0ex}{0ex}}({N}_{\ensuremath{\psi}(2S)}/{N}_{J/\ensuremath{\psi}}{)}_{p\text{}\text{\ensuremath{-}}p}$ is computed in three Pb-Pb collision centrality bins and two kinematic ranges: one at midrapidity, $|y|<1.6$, covering the transverse momentum range $6.5<{p}_{T}<30\text{ }\text{ }\mathrm{GeV}/c$, and the other at forward rapidity, $1.6<|y|<2.4$, extending to lower ${p}_{T}$ values, $3<{p}_{T}<30\text{ }\text{ }\mathrm{GeV}/c$. The centrality-integrated double ratio changes from $0.45\ifmmode\pm\else\textpm\fi{}0.13(\text{stat})\ifmmode\pm\else\textpm\fi{}0.07(\text{syst})$ in the first range to $1.67\ifmmode\pm\else\textpm\fi{}0.34(\text{stat})\ifmmode\pm\else\textpm\fi{}0.27(\text{syst})$ in the second. This difference is most pronounced in the most central collisions.