Why doesn't this work?
Well, the subquery that you have is:
SELECT IM_Data
INTO ItemList
FROM IM_DataTable
WHERE xRowNum<=1
This is perfectly valid syntax for creating a table, called ItemList, in the current database. However, this syntax is not allowed in an if statement.
So you could phrase this as:
SELECT IM_Data
INTO ItemList
FROM IM_DataTable
WHERE xRowNum<=1
if exists (select * from itemlist)
Or you could dispense with the additional table altogether:
if exists (select * from IM_DataTable WHERE xRowNum<=1)
Or, you might have some other intention altogether.
IFthere?, what is it that you want to do?