I just tried those steps for a proc in the Adventureworks and my CREATE PROC was *not* encapsulated
inside sp_executesql. I douns that anything but the SSMS version would make a difference (and we
have the same SSMS version), but I've pasted my version list at the end of this post.
However, I think I found the setting. In SSMS, tools, options, scripting, "Include OF NOT EXIST
clause". Setting this to make my SSMS to wrap the CREATE PROC inside sp_executesql.
Microsoft SQL Server Management Studio 9.00.3042.00
Microsoft Analysis Services Client Tools 2005.090.3042.00
Microsoft Data Access Components (MDAC) 2000.085.1117.00 (xpsp_sp2_rtm.040803-2158)
Microsoft MSXML 2.6 3.0 4.0 5.0 6.0
Microsoft Internet Explorer
7.0.5730.11
Microsoft .NET Framework
2.0.50727.1433
Operating System
5.1.2600
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi