string ls_sql
ls_sql = 'create procedure popo4 (@id int) as begin set nocount on end if (@id is null) begin select property, version, value, lvalue from dbo.dtproperties where @id=objectid end else begin select count(*) from aa end'
execute immediate :ls_sql;