The second catalogue of Planck Sunyaev-Zeldovich (SZ) sources, hereafter PSZ2, represents the largest galaxy cluster sample selected by means of their SZ signature in a full-sky survey. Using telescopes at the Canary Island observatories, we conducted the long-term observational program 128- MULTIPLE-16/15B (hereafter LP15), a large and complete optical follow-up campaign of all the unidentified PSZ2 sources in the northern sky, with declinations above −15° and no correspondence in the first Planck catalogue PSZ1. This paper is the third and last in the series of LP15 results, after Streblyanska et al. (2019, A&A, 628, A13) and Aguado-Barahona et al. (2019, A&A, 631, A148), and presents all the spectroscopic observations of the full program. We complement these LP15 spectroscopic results with Sloan Digital Sky Survey archival data and other observations from a previous program (ITP13-08), and present a catalogue of 388 clusters and groups of galaxies including estimates of their velocity dispersion. The majority of them (356) are optical counterparts of PSZ2 sources. A subset of 297 of those clusters are used to construct the MSZ − Mdyn scaling relation based on the estimated SZ mass from Planck measurements and our dynamical mass estimates. We discuss and correct for different statistical and physical biases in the estimation of the masses, such as the Eddington bias when estimating MSZ and the aperture and the number of galaxies used to calculate Mdyn. The SZ-to-dynamical mass ratio for those 297 PSZ2 clusters is (1 − B) = 0.80 ± 0.04 (stat) ± 0.05 (sys), with only marginal evidence for a possible mass dependence for this factor. Our value is consistent with previous results in the literature, but is associated with a significantly smaller uncertainty due to the use of the largest sample size for this type of study.