title: Invalid object name 'sys.dm_exec_procedure_stats' error
body: <p>I am trying to obtain the maximum time consumed by a stored procedure in my DB. I obtained a sample query from <a href="https://msdn.microsoft.com/en-us/library/cc280701(v=sql.110).aspx" rel="nofollow">here</a> to obtain the same using sys.dm_exec_procedure_stats. The same is posted below. Whenever I try to execute this query I get the error as </p>
  
  <blockquote>
    <p>Msg 208, Level 16, State 1, Line 1
    Invalid object name 'sys.dm_exec_procedure_stats'.</p>
  </blockquote>
  
  <p>Can you please let me know where I might probably be going wrong?</p>
  
  <p>Below is the query used. No changes made.</p>
  
  <pre><code>SELECT TOP 10 d.object_id, d.database_id, OBJECT_NAME(object_id, database_id) 'proc name',
         d.cached_time, d.last_execution_time, d.total_elapsed_time,
         d.total_elapsed_time/d.execution_count AS [avg_elapsed_time],
         d.last_elapsed_time, d.execution_count
  FROM sys.dm_exec_procedure_stats AS d
  ORDER BY [total_worker_time] DESC;
  </code></pre>
  
  <p>EDIT: Sorry for the blunder. Server is 2005.</p>