In the above example you can see the cadence in C major with modulation to B major. The main modulating chord here is on the beat 4 in measure 1:
Dominant seventh chord in C major but respelled enharmonically as II34 chord in B major with the triple alteration (lowered 6th scale degree in the bass, raised 2nd scale degree in the tenor, and raised 4th scale degree in the soprano).
Here is the easiest way to apply this kind of modulation in practice:
Choose the destination key a half-step lower than the original key (major or minor), play a cadence in the old key and at the moment you want to modulate, play a Dominant seventh chord of the original key which simply leads to the Tonic 64 chord of the destination key followed by the Dominant and the Tonic chords in the new key.
Of course, there are other more advanced ways to complete this kind of enharmonic modulation (and the range of keys is much wider) but this is something you can put into practice right away.