DECLARE @sortDir varchar(5) SELECT @sortDir = CASE WHEN @SortDirection = "Ascending" THEN ' ASC' WHEN @SortDirection = "Descending" THEN ' DESC' END Msg 207, Level 16, State 1, Procedure sp2_GetAllCategories, Line 17 Invalid column name 'Ascending'. Msg 207, Level 16, State 1, Procedure sp2_GetAllCategories, Line 18 Invalid column name 'Descending'.