as set @tablename = ltrim(rtrim(@tablename)) set @columnname = ltrim(rtrim(@columnname))
declare @string varchar(8000)
if exists( select * from syscolumns where id=object_id(@tablename) and name = @columnname ) begin select @string =' alter table '+ @tablename + ' drop column [' + ltrim(rtrim(@columnname)) + ']' print @string execute(@string) end