In SQL Server, you can use the SET STATISTICS PROFILE
statement to display the profile information for a T-SQL statement.
STATISTICS PROFILE
works for ad hoc queries, views, and stored procedures.
When STATISTICS PROFILE
is set to ON
, each executed query returns its regular result set, followed by an additional result set that shows a profile of the query execution.