This is a simple Altered Melody that works on a dominant 7th chord with a #5, #11, #9 and b9 and comes from the 7th mode of melodic minor (i.e. B7 alt = the 7th mode of C melodic minor).
This melody should help you learn the altered scale in the context of a melodic phrase that resolves a 4th away (i.e. G7 Alt resolving to C major)
See also Lesson 34: Altered Scale
See also Lesson 46: Alt. Dom. Melody
Use this mp3 to learn to sing and “hear” the melody well. Once you can hear it well, learn to play it on your instrument.
Below is John Coltrane playing over his song “Crescent” – during this solo he uses the Altered Scale extensively.