As the ERROR already explains, use EXISTS
If (EXISTS(SELECT DISTINCT theFN FROM aDT
WHERE theFN = @pF and theIN = @pI
and theLN = @pL and theANA = @pLY))
BEGIN
SET @Bool = 1
RETURN @Bool
END
Similarly change the other IF too...
EDIT: EXISTS is used when the number of rows could be zero. Also if you SELECT
just one value to compare, it should work too.