The deuteration of molecules forming in the ices such as methanol (CH_3_OH) is sensitive to the physical conditions during their formation in dense cold clouds and can be probed through observations of deuterated methanol in hot cores. The aim is to determine the D/H ratio of methanol for a large sample of 99 high-mass protostars and to link this to the physical conditions during the formation of methanol in the prestellar phases. Observations with the Atacama Large Millimeter/submillimeter Array (ALMA) containing transitions of CH_3_OH, CH_2_DOH, CHD_2_OH, ^13^CH_3_OH, and CH_3_^18^OH are investigated. The column densities of CH_2_DOH, CHD_2_OH, and CH_3_OH are determined for all sources, where the column density of CH_3_OH is derived from optically thin ^13^C and ^18^O isotopologues. Consequently, the D/H ratio of methanol is derived taking statistical effects into account. Singly deuterated methanol (CH_2_DOH) is detected at the 3{sigma} level toward 25 of the 99 sources in our sample of the high-mass protostars. Including upper limits, the <D/H>_CH3OH_ ratio inferred from N_CH2DOH_/N_CH3OH_ was derived for 38 of the 99 sources and varies between ~10-3-10-2. Including other high-mass hot cores from the literature, the mean methanol D/H ratio is 1.1+/-0.7x10^-3^. This is more than one order of magnitude lower than what is seen for low-mass protostellar systems (2.2+/-1.2x10^-2^). Doubly deuterated methanol (CHD_2_OH) is detected at the 3{sigma} level toward 11 of the 99 sources. Including upper limits for 15 sources, the <D/H>_CH2DOH_ ratios derived from N_CH2DOH_/N_CH2DOH_ are more than two orders of magnitude higher than <D/H>_CH3OH_ with an average of 2.0+/-0.8x10^-1^ which is similar to what is found for low-mass sources. Comparison with literature GRAINOBLE models suggests that the high-mass prestellar phases are either warm (>20K) or live shorter than the free-fall timescale. In contrast, for low-mass protostars, both a low temperature of <15K and a prestellar phase timescale longer than the free-fall timescale are necessary. The <D/H>_CH3OH_ ratio drops by more than an order of magnitude between low-mass and high-mass protostars due to either a higher temperature during the prestellar phases or shorter prestellar phases. However, successive deuteration toward CHD_2_OH seems equally effective between low-mass and high-mass systems.