well there are scales, and then there are modes.the term scale more refers to the main step pattern...or a series of notes running up or down in a stepwise fashion. modes are different patterns of intervals of a scale. for example, if i am writing a song the key of C, this is what the main scale i would play in C would be....
C D E F G A B C
thats called the major scale. here are some mode scales....
Ionian C D E F G A B C Modern Major Scale
Dorian D E F G A B C D
Phrygian E F G A B C D E
Lydian F G A B C D E F
Mixolydian G A B C D E F G
Aeolian A B C D E F G A (Modern Minor Scale)
Locrian B C D E F G A B
the answer is yes you can use different modes and scales. you can play different modes against different chords to make different sounds, but only certain ones will sound right with another chord.
and no one really "writes" a guitar solo....its more like improvisation. you can combine different modes with chord changes, but rock and blues will mostly use dorian mode and mixolydian mode.
hope this helps....i hope i explianed it right.