As a competent bass guitarist you will need to be able to play the 12 Bar Blues progression in any key. The process of changing keys is called transposing.
The following riff is in the key of G:
This riff starts on the G note (to match the G chord). When the chord changes to C and D the riff position will change accordingly (starting on the C and D notes respectively).