SELECT [Projname],[version],[state] FROM [dbo].[Goods] WHERE [Projname] = CASE WHEN @Projname IS NULL THEN [Projname] ELSE @Projname END或者
SELECT [Projname],[version],[state] FROM [dbo].[Goods] WHERE ([Projname] = @Projname OR @Projname IS NULL )