See query plan for MSSQL query

Run the following query to get the query plan of the running queries:

SELECT sqltext.text,
      
queryplan.query_plan,
      
req.session_id,
      
req.status,
      
req.command,
      
req.cpu_time,
      
req.total_elapsed_time,
      
req.wait_type,
      
req.wait_time,
      
req.open_resultset_count,
      
req.open_transaction_count,
      
req.percent_complete,
      
req.estimated_completion_time,
      
req.reads,
      
req.transaction_isolation_level,
      
req.row_count,
       *
FROM sys.dm_exec_requests req
        
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
        
CROSS APPLY sys.dm_exec_query_plan(req.plan_handle) AS queryplan

Then send the output to https://www.brentozar.com/pastetheplan/ for a visual representation.

Thanks to Morten Minke for finding this very helpful query!