DECLARE @SqlStatement nvarchar(max)
SET @SqlStatement = N'
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE dbo.usp_test
@SiteNo smallint
AS
BEGIN
SET NOCOUNT ON;
RETURN 0;
END
';
--PRINT @SqlStatement
BEGIN TRY
exec('연결된서버명.데이터베이스명.dbo.sp_executesql @statement=N''' + @SqlStatement + '''');
END TRY BEGIN CATCH
PRINT ERROR_MESSAGE();
END CATCH;