One way to quickly select blocks of code within SSMS is to minimize the code using the -
button next to the leading keyword in a SQL statement (e.g. SELECT, UPDATE, DELETE, WITH, etc.) then highlight that line and press F5
to execute it.

Depending on your version of SSMS (newer versions obviously being preferred in this case), there are also some keyboard shortcuts you can use to collapse/expand a section. The keyboard shortcut link provided by Simon Hellings' earlier response alludes to hotkeys already being set, but I cannot confirm they actually work. However, you can set some custom hotkeys to do this as follows:
The functions we're concerned with setting hotkeys for are found under the Edit
-> Outlining
Menu Options:

To set the hotkeys, navigate to Tools
-> Options...
-> Environment
-> Keyboard
-> Keyboard
. Type in Outlin
into the Show commands containing: box. Then assign a new shortcut key combinations for Edit.ToggleAllOutlining
and Edit.ToggleOutliningExpansion
and press Assign
:

Now, check the shortcuts took after pressing Ok and your shortcut keys should work as expected. As you can see, I assigned mine to CTRL+ALT+Left Arrow
and CTRL+ALT+Right Arrow
, but you can use whatever you want:

Finally if this doesn't work, you may have to switch to a different SQL client. It sounds like the functionality you want is similar to executing an Oracle PL/SQL block via CTRL + ENTER
within Oracle SQL Developer. You can use Oracle SQL Developer to connect to SQL Server using Third Party Database JDBC drivers (ref), but I don't recommend it.