So if @MyTable is empty, you want all rows, but if there are values, you only want the matches?
The simple-minded solution would be:
IF NOT EXISTS (SELECT * FROM @MyTable)
SELECT ... FROM dbo.DataTable
ELSE
BEGIN
SELECT ...
FROM dbo.DataTaable dt
WHERE dt.item IN (SELECT t.item FROM @MyTable t)
END
If you have more conditions of this kind, so that it gets impractical with multiple statements, you can do:
SELECT @hasvalues = IIF(EXISTS (SELECT * FROM @MyTable), 1, 0)
SELECT ...
FROM dbo.DataTaable dt
WHERE (@hasvalues = 0 OR dt.item IN (SELECT t.item FROM @MyTable t)