The choice of scale depends on the chord or chord progression.  As a rule of thumb, Major scales work well over Major chords, and Minor scales over Minor chords.  For example, if a song is in C Major, you can use the C Major scale to solo over it.  However, music is all about creativity and experimentation!