Well, there are a million possibilities, but I'll explain two of them right now.
The first way you could handle this is by treating each short segment as a different part of the song. Over the C Major vamp, you can use any scale or mode that contains the notes of that chord (C, E, and G), so you can use C Lydian, Ionian, Mixolydian, Major Pentatonic, Bebop, etc. Over the D Major part, you can use any scale or mode with the notes of this chord (D, F#, A), so you can use D Lydian, Ionian, blah, blah, blah. There are quite a few jazz songs that are like Bm7 for a while then Bbm7 for a while or something like that. This C for a while and D for a while is similar.
The second way this can be viewed is as a chord progression. This works especially well if the chords change quickly, like C for 2 beats and D for 2 beats, Take the notes of both chords and put them together (C, E, G + D, F#, A), and you get C, D, E, F#, G, A. You can use any scale or mode with these notes. Now this seems to limit your choices a lot, but you can use C Lydian (C, D, E, F#, G, A, B), C Lydian b7 (C, D, E, F#, G, A, Bb), C Major Pentatonic (C, D, E, G, A), as well as throwing in the b9 as a passing note (which is really the b5 of A Minor Pentatonic, aka Blues Scale). You could also use just those six notes, which gets you a hexatonic C scale (C, D, E, F#, G, A).
As you can see, you have many choices... the key is to experiment and listen. Judge for yourself what sounds good and use it. Don't be afraid to try new scales, chords, licks, or just whatever.
"You must stab him in the heart with the Bone Saber of Zumacalis... well, you could stab him in the head or the lungs, too... and the saber, it probably doesn't have to be bone, just anything sharp lying around the house... you could poke him with a pillow and kill him."
- Aqua Teen Hunger Force, The Universal Re-Monster