ssms tools pack claims to do this: http://www.ssmstoolspack.com/ . Example code:
USE [AdventureWorks];
GO
IF OBJECT_ID('[Person].[usp_AddressSelect]') IS NOT NULL
BEGIN
DROP PROC [Person].[usp_AddressSelect]
END
GO
CREATE PROC [Person].[usp_AddressSelect]
@AddressID INT
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRAN
SELECT [AddressID], [AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode], [rowguid], [ModifiedDate]
FROM [Person].[Address]
WHERE ([AddressID] = @AddressID OR @AddressID IS NULL)
COMMIT
GO
IF OBJECT_ID('[Person].[usp_AddressInsert]') IS NOT NULL
BEGIN
DROP PROC [Person].[usp_AddressInsert]
END
GO
CREATE PROC [Person].[usp_AddressInsert]
@AddressLine1 nvarchar(60),
@AddressLine2 nvarchar(60),
@City nvarchar(30),
@StateProvinceID int,
@PostalCode nvarchar(15),
@rowguid uniqueidentifier,
@ModifiedDate datetime
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRAN
INSERT INTO [Person].[Address] ([AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode], [rowguid], [ModifiedDate])
SELECT @AddressLine1, @AddressLine2, @City, @StateProvinceID, @PostalCode, @rowguid, @ModifiedDate
-- Begin Return Select <- do not remove
SELECT [AddressID], [AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode], [rowguid], [ModifiedDate]
FROM [Person].[Address]
WHERE [AddressID] = SCOPE_IDENTITY()
-- End Return Select <- do not remove
COMMIT
GO
IF OBJECT_ID('[Person].[usp_AddressUpdate]') IS NOT NULL
BEGIN
DROP PROC [Person].[usp_AddressUpdate]
END
GO
CREATE PROC [Person].[usp_AddressUpdate]
@AddressID int,
@AddressLine1 nvarchar(60),
@AddressLine2 nvarchar(60),
@City nvarchar(30),
@StateProvinceID int,
@PostalCode nvarchar(15),
@rowguid uniqueidentifier,
@ModifiedDate datetime
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRAN
UPDATE [Person].[Address]
SET [AddressLine1] = @AddressLine1, [AddressLine2] = @AddressLine2, [City] = @City, [StateProvinceID] = @StateProvinceID, [PostalCode] = @PostalCode, [rowguid] = @rowguid, [ModifiedDate] = @ModifiedDate
WHERE [AddressID] = @AddressID
-- Begin Return Select <- do not remove
SELECT [AddressID], [AddressLine1], [AddressLine2], [City], [StateProvinceID], [PostalCode], [rowguid], [ModifiedDate]
FROM [Person].[Address]
WHERE [AddressID] = @AddressID
-- End Return Select <- do not remove
COMMIT TRAN
GO
IF OBJECT_ID('[Person].[usp_AddressDelete]') IS NOT NULL
BEGIN
DROP PROC [Person].[usp_AddressDelete]
END
GO
CREATE PROC [Person].[usp_AddressDelete]
@AddressID int
AS
SET NOCOUNT ON
SET XACT_ABORT ON
BEGIN TRAN
DELETE
FROM [Person].[Address]
WHERE [AddressID] = @AddressID
COMMIT
GO
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------