In this work, we apply a recent technique for the generation of stimulated Brillouin scattering (SBS) dynamic gratings that are both localized and stationary to realize high-resolution distributed temperature sensing. The gratings generation method relies on the phase modulation of two pump waves by a common pseudo-random bit sequence (PRBS), with a symbol duration that is much shorter than the acoustic lifetime. This way the acoustic wave can efficiently build up in the medium at discrete locations only, where the phase difference between the two waves does not temporarily vary. The separation between neighboring correlation peaks can be made arbitrarily long. Using the proposed method, we experimentally demonstrate distributed temperature sensing with 5 cm resolution, based on modifications to both the local birefringence and the local Brillouin frequency shift in polarization maintaining fibers. The localization method does not require wideband detection and can generate the grating at any random position along the fiber, with complete flexibility. The phase-coding method is equally applicable to high-resolution SBS distributed sensing over standard fibers.