Domininants that are "functioning" can be altered for more tension. To alter you can:
- flatten or raise the 5 (b5, #5)
- add a flat or raised 9 (b9, #9)
Therefore, when you see a G7 followed by Amaj on a chart, that is a functioning dominant going to a I, or tonic. In this instance, you could play G7b9#5 instead of G7.
Once these chords are "altered," you will likely want to solo over them with an "altered scale."
The altered scale (otherwise knows as the "super-locrian") is actually the 7th mode of the Harmonic Minor scale. It contains all the altered possibilities for an altered dominant chord -- the b9, #9, b5, #5 -- along with the root, major 3rd and flat seventh of the dominant chord. For a G Altered scale, the notes are:
G, Ab, Bb, Cb(B), Db, Eb, F.
This works out stepwise as:
Root, st, T, st, T, T, T.
If you started this scale on the Ab, you would be playing the Ab melodic minor scale. The altered scale is also known as the "super-locrian" scale, as it starts on the 7th tone of the melodic minor. The "parent" scale of the super-locrian, is always one semi-tone above. So to find the altered scale for F7b5#9, play notes in the Harmonic Minor one semi-tone up from F and you will have the notes in the F altered.
Basically, the notes of F altered and Gb Melodic Minor are the same, which is the beauty of modes. If you know the notes in one, you know the notes in the other. F is one semi-tone down from Gb Melodic Minor, which makes F altered the 7th mode of Gb Melodic Minor. That's where the "locrian" part comes in.
If you don't know the Melodic Minor, it is essentially the major scale with a flat third. Unlike the natural minor, the 7th in the Meldoic Minor scale is a Major 7th, only one semi-tone down from the root.
The altered scale starts almost like the phrygian, but some things slide around in the middle. The upper half of the scale also resembles the whole tone scale.
Here's a pdf to visualize where the altered notes are for chord construction: