Scales to Play Over B7
Every chord is a subset of several scales: any scale that contains all of a chord's tones fits over it. Pick a chord to see the matching scales from its own root, the major keys the chord belongs to, and full fretboard diagrams for every scale on guitar.
A B7 chord contains the notes B – D# – F# – A. Any scale that includes every one of those 4 tones fits over it — from the root B, that means B Mixolydian, B Dorian Bebop, B Mixolydian Bebop, B Half Whole Diminished, B Spanish and B Gypsy Major. Start with the first scale listed: it is the most common choice, and the others color the same chord tones differently.
B7 is also diatonic to one major key: E major (relative minor C#m). In a song from one of those keys you can also solo with the key's own major scale or its relative minor pentatonic across the whole progression, not just this chord.