--判断字段不存在则添加 if not exists(select * from sys.columns where name='字段名' and [object_id]=object_id(N'表名')) alter table 表名 add 字段名 nvarchar(255) --判断字段存在则删除 if exists(select * from sys.columns where name='字段名' and [object_id]=object_id(N'表名')) alter table 表名 drop column 字段名
原文链接:https://blog.csdn.net/qq_22103321/article/details/122831763