Here is my current SQL Server query:
Code:
SELECT 
     COUNT(*) over () as countNum,
     [F1] AS STANDARDandOBJ,
     [F2] AS CLUSTER,
     [F3] AS OBJECTIVE,
     [F4] AS EXTRA0,
     CASE 
        WHEN COL_LENGTH('[tmpExcelDB].[dbo].[''Nursing$'']', [F5]) IS NULL 
        THEN 'NO' ELSE CONCAT([F1], [F2]) 
     END AS COMBINEF1F2 
FROM 
    [tmpExcelDB].[dbo].['Nursing$'] 
WHERE 
    LOWER(F3) NOT LIKE 'planning tools-%'
This works just fine as long as the table has F5 within it. Otherwise, it throws an error:

Invalid column name 'F5'.
How can I modify the above query if there's an F5 column or when there's not going to be one?