Measurements of prompt $\psi$(2S) meson production cross sections in proton-lead (pPb) and proton-proton (pp) collisions at a nucleon-nucleon center-of-mass energy of $\sqrt{s_{_\mathrm{NN}}}=$ 5.02 TeV are reported. The results are based on pPb and pp data collected by the CMS experiment at the LHC, corresponding to integrated luminosities of 34.6 nb$^{-1}$ and 28.0 pb$^{-1}$, respectively. The nuclear modification factor $R_\mathrm{pPb}$ is measured for prompt $\psi$(2S) in the transverse momentum range 4 $<$ p$_\mathrm{T}$ $<$ 30 GeV$/c$ and the center-of-mass rapidity range $-$2.4 $< y_\mathrm{cm} <$ 1.93. The results on $\psi$(2S) $R_\mathrm{pPb}$ are compared to the corresponding modification factor for prompt J$/\psi$ mesons and are found to be more suppressed than the J$/\psi$ states over the entire kinematic range studied.