Despite what DBAs will tell you ("use stored procedures because the server will optimize them thus they are faster than ad-hoc queries"), I have heard that SQL server does not actually optimize stored procedures.
So, does SQL Server optimize stored procedures? Does it even parse them beforehand, or does it just store them internally as a sql script?
I did not ask about a specific SQL Server version because I assume history is relevant in a meaningful understanding.
Note that my question is NOT, "Are ad-hoc queries as fast as stored procedures?" There are too many other factors involved in answering this.