There are two basic approaches to soloing. One is the thing that most of us guys who were steeped in blues based rock playing all gravitate towards ... and that is to, after understanding what the chord changes are that you are going to solo over, you ask, what is one scale that I could use to play over all these chords? And, to some extent you can be successful doing that ... but eventually you run into walls since you are only thinking diatonically. So, then, what happens when a chord comes up that uses notes outside the diatonic safe space of your harmonic environment? You have to then bring in notes outside your scale.
The other approach comes to us from Jazz and I think it's a much more holistic way of thinking about music. Instead of asking what scale can I use over all these chords and then being stumped when a chord with a non scale tone comes about, why not just ask on a moment to moment basis which chord is it that is happening underneath me right now? Then you use a scale that fits that new chord in question. As soon as another new chord is introduced, you simply alter your scale to use notes that now work well over that chord. A jazz guy might call this "playing through the changes" ... you are switching your scale up to fit each chord that is happening underneath you at any given moment.
I know at first this sounds like a much more difficult approach ... it sounds like suddenly you have to learn a million scales but I've found that not to be the case. Also, when you learn to solo this way, you are set for any situation that you might find yourself in. So long as you know the changes, you can solo. I mean, sure, the best deal would be to just automatically know all the scales and arpeggios of every type of chord in every position, but it's much easier to do this calculus live and in the moment than it might at first seem. You can even build lead lines just based solely off notes in the current chord. After a while of doing this you just start to see little licks built around most every chord you know that just demand that you play them when you hear that chord. Ultimately we should try to see chords and the licks around them all at the same time.
The easiest way to get going with this is to come with a little set of changes that uses non-diatonic chords so you have to start thinking about what's underneath you at any given moment, and then solo over that for a bit. It's easy once you start thinking that way.
Try maybe something like D, C, G, Bb
So, over the D, C and G you can easily see that it's all diatonic to the major key of G. So, you'd be soling in that scale over the first 3/4 of this progression ... but then when the pesky Bb major come up, what do we do? At that point you would do something almost like a key change. When the Bb comes up, you solo in the scale of Bb major over just that chord. But it doesn't have to always be the Bb major scale ... technically it can be any scale that has a Bb major chord within it's diatonic structure ... so, for instance, you could use the key of F major over that part ... then, to take it out even further, do what the jazz guys do and change it up each time the Bb rolls around ... so the first time maybe you do use the Bb major scale ... maybe the next time it rolls around you use F major ... maybe the third time you use Eb major. These are all keys that feature a Bb major within them.
The sky is the limit. If it sounds good, it is!