Use @DBNAME

if EXISTS(select IS_NULLABLE,COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS 
		 where TABLE_NAME ='WebSection' 
		 AND COLUMN_NAME='PatternId'
		 AND IS_NULLABLE = 'NO')
BEGIN
	alter table WebSection
	alter column PatternId int null
END



