Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Network Performance Monitor (NPM) > Get execution count of a Stored Procedure

Get execution count of a Stored Procedure

Table of contents
Created by Wendell Bazile, last modified by Aileen de Lara_ret on Sep 01, 2016

Views: 40 Votes: 0 Revisions: 3


Steps to get the Execution Count of a Stored Procedure.


All Orion Core products


Attach to the database via database manager or sql management studio and run the following query:

SELECT DB_NAME(st.dbid) DBName

      ,OBJECT_SCHEMA_NAME(st.objectid,dbid) SchemaName

      ,OBJECT_NAME(st.objectid,dbid) StoredProcedure

      ,max(cp.usecounts) Execution_count

 FROM sys.dm_exec_cached_plans cp

         CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st

 where DB_NAME(st.dbid) is not null and cp.objtype = 'proc'

   group by cp.plan_handle, DB_NAME(st.dbid),



 order by max(cp.usecounts)





Last modified
21:03, 31 Aug 2016