Executing QP metrics

You can activate and use QP metrics at the server level or at the session level.

At the server level, use sp_configure with the enable metrics capture option. The QP metrics for ad hoc statements are captured directly into a system catalog, while the QP metrics for statements in a stored procedure are saved in a procedure cache. When the stored procedure or query in the statement cache is flushed, the respective captured metrics are written to the system catalog.

sp_configure "enable metrics capture", 1

At a session level, use set metrics_capture on/off:

set metrics_capture on/off