The following powershell script seems to generate a "Create" stored procedure script successfully
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$srv = new-object Microsoft.SqlServer.Management.Smo.Server("<SERVER>")
$db = $srv.Databases.Item("<Database>")
$proc = $db.StoredProcedures.Item("<StoredProcedure>")
$proc.Script() > testScript.sql
Is there anyway to create an "Alter" using a similar approach i.e. changing the scripting options? I am referencing a SQL Server 2005 environment.
I could always add a statement to replace "CREATE PROC" with "ALTER PROC" but this seems inelegant...