I placed a SELECT statement inside of a loop and it runs fine until 10,000 loops which consistently crashed SSMS. Of course, this is probably a RAM issue and probably useless of placing a SELECT statement inside of a loop which does not really display the result until the end of the loop.
Just out of curiosity, is it possible to clear the cache or whatever to prevent the crash? I have tried:
DBCC FREESYSTEMCACHE ('ALL')