Reconnect "not connected" query windows in SSMS to original connection
In SSMS, if you run a query in a disconnected window, it will attempt to re-connect to the prior connection. You will get an error, then the window will reconnect.  If you run a query like SELECT 1;, it will reconnect without having to do any data access/manipulation.

However, I'm a bit timid about relying on this to remember what server I was previously connected to. While I have noticed this to be the behavior, it is not documented, so I do not fully trust that it is "as designed" vs "the way it works." You should always make sure you are connected to the correct server before running any scripts.