Context. To understand the chemistry of sulphur (S) in the interstellar medium, models need to be tested by observations of S-bearing molecules in different physical conditions. Aims. We aim to derive the column densities and abundances of S-bearing molecules in high-mass dense cores in different evolutionary stages and with different physical properties. Methods. We analysed observations obtained with the Institut de RadioAstronomie Millimétrique (IRAM) 30 m telescope towards 15 well-known cores classified in the three main evolutionary stages of the high-mass star formation process: high-mass starless cores, high-mass protostellar objects, and ultracompact HII regions. Results. We detected rotational lines of SO, SO+, NS, C34S, 13CS, SO2, CCS, H2S, HCS+, OCS, H2CS, and CCCS. We also analysed the lines of the NO molecule for the first time to complement the analysis. From a local thermodynamic equilibrium approach, we derived the column densities of each species and excitation temperatures for those that are detected in multiple lines with different excitation. Based on a statistical analysis of the line widths and the excitation temperatures, we find that NS, C34S, 13CS, CCS, and HCS+ trace cold, quiescent, and likely extended material; OCS, and SO2 trace warmer, more turbulent, and likely denser and more compact material; SO and perhaps SO+ trace both quiescent and turbulent material, depending on the target. The nature of the emission of H2S, H2CS, and CCCS is less clear. The molecular abundances of SO, SO2, and H2S show the strongest positive correlations with the kinetic temperature, which is thought to be an indicator for evolution. Moreover, the sum of all molecular abundances shows an enhancement of gaseous S from the less evolved to the more evolved stages. These trends could be due to the increasing amount of S that is sputtered from dust grains owing to the increasing protostellar activity with evolution. The average abundances in each evolutionary group increase, especially in the oxygen-bearing molecules, perhaps due to the increasing abundance of atomic oxygen with evolution owing to photodissociation of water in the gas phase. Conclusions. Our observational work represents a test-bed for theoretical studies aimed at modelling the chemistry of sulphur during the evolution of high-mass star-forming cores.