title: Full execution history of a stored procedure
body: <p>I am wondering how to get the <code>execution_time</code> for <strong>all executions</strong> for a specific stored procedure. (using Microsoft SQL Server 2016)</p>
  
  <p>I know that via <code>dm_exec_procedure_stats</code> I get information about the <code>last_execution_time</code> and <code>execution_count</code> but I am interested in the <code>execution_time</code> of every execution (of one stored procedure) which got counted for the <code>execution_count</code>. </p>
  
  <p>What I get is something like this (as an example):</p>
  
  <pre><code>| name     | database_id | execution_count | last_execution_time |
  ------------------------------------------------------------------
  | sp_name1 | db_id1      | 23              | 11.09.2019 hh:mm:ss |
  | sp_name2 | db_id1      | 12              | 09.09.2019 hh:mm:ss |
  | sp_name3 | db_id2      | 3456            | 11.09.2017 hh:mm:ss |
  </code></pre>
  
  <p>So basically I want a query to get a table which has in one column the name of the procedure and in the other the execution times of this procedure such that the number of rows should equal the <code>execution_count</code> from the procedure.</p>
  
  <p>What I want is something like this:</p>
  
  <pre><code>| name     | database_id | execution_time      |
  ------------------------------------------------
  | sp_name1 | db_id1      | 11.09.2019 hh:mm:ss |
  | sp_name1 | db_id1      | dd.mm.yyyy hh:mm:ss |
  | sp_name1 | db_id1      | dd.mm.yyyy hh:mm:ss |
  | ...      | ...         | ...                 |
  </code></pre>
  
  <p>which should have 23 rows. </p>