• Hi,

    Thanks for reply

    create procedure aa

    as

    begin

    if exists (select * from sys.objects where name='bb')

    begin

    drop procedure bb

    go

    declare @a nvarchar(max)

    set @a='create procedure bb as begin print ''bb'' end'

    exec sp_executesql @a

    end

    end

    after run this code i got following error message

    Msg 102, Level 15, State 1, Procedure aa, Line 9

    Incorrect syntax near 'bb'.

    Msg 156, Level 15, State 1, Line 7

    Incorrect syntax near the keyword 'end'.