[sql] SQL Server reports 'Invalid column name', but the column is present and the query works through management studio