Why is sql stored procedure called a stored procedure
<p>A few days ago I was asked this question(tel intvw) and I was drawn blank. I said execution plan is stored in the server so its called STORED Procedure. But I am not sure I was correct.</p>

<p>My research after that has shown that there is plan cache or procedure cache inside of SQL Server that's dedicated to storing execution plans. In <a href="http://sqlmag.com/database-performance-tuning/sql-server-plan-cache-junk-drawer-your-queries" rel="nofollow">that article</a> there is also reference to what is called compiled plan stub. So it appears that Compiled Plan Stub is first created and then execution plan is created. </p>

<p>So what I wanted to know is briefly</p>

<ol>
<li><p><strong>What are the steps that happen when I create a stored procedure?</strong></p></li>
<li><p><strong>Why is a Stored Procedure called stored procedure</strong>(if the question makes sense)?</p></li>
</ol>

<p>If you can refer me to an existing SO question or some other article, that should also be fine. </p>