Here’s an article you may find worth a read–A step-by-step approach to rock and jazz guitar improvization. Here’s a short excerpt:
STEP 1: LEARNING THE NAMES OF THE INDIVIDUAL NOTES ON THE ENTIRE FRETBOARD – This is vital because in the art of improvisation, one has to know where one is on the fretboard at all times, regardless of what type of music is being played or improvised. Without knowing all the notes on the fretboard, it becomes easy to get lost and fall behind on the tune (while the chord changes the other musicians in the band are playing just roll on by). The natural shortcut, or the easy way out, is to only learn some of the notes on the fretboard. This approach will have at least two undesirable results: (A) the limited ability of only being able to improvise in certain keys (like A and E), and/or, (B) the limited ability of only being able to improvise on certain areas of the guitar neck. Jamming with other musicians and having these types of situations arise tends to lead to a good deal of embarrassment.