There are other ways to create an if statement in SQL. For example, you can use a SELECT CASE, and that will return a result depending on a condition. For example:
SELECT CASE WHEN EXISTS(SELECT 1 FROM Table1) THEN 1 ELSE 0 END
Or, you could insert into an intermediary table:
INSERT INTO BoolTable(BoolValue) VALUES
(
SELECT CASE WHEN EXISTS(SELECT 1 FROM Table1)
THEN 1 ELSE 0 END
)
SELECT TOP 1 @IsTrue = BoolValue
FROM BoolTable ORDER BY BoolTableID DESC
A similar technique would be to generate the BoolTable row, then pass in the ID for the prepared statement to update (to make sure your code isn't conflicting with some other code that is also using the "BoolTable"):
UPDATE BoolTable SET BoolValue =
(SELECT CASE WHEN EXISTS(SELECT 1 FROM Table1)
THEN 1 ELSE 0 END)
WHERE BoolTableID = @BoolTableID
I'm not sure how they work in MySQL, but you could also use an output parameter (a parameter to gets passed to the caller):
SELECT @OutIsTrue =
CASE WHEN EXISTS(SELECT 1 FROM Table1) THEN 1 ELSE 0 END
Anyway, those are just some ideas. I didn't check any of them (I play with MSSQL, not MySQL), but I'm sure one of them has to work.