This query is leveraged in our recommended read to assist in auditing unsupported software. Credit to Jainidhya for assembling this little beauty.
Set variable as $$Version$$ with type 'string' and another variable as $$Name$$ with type 'string'
Once you know what program name and version you are searching for, you can simply use the following:
SELECT name, version, publisher,
WHEN version >= '$$Version$$' THEN 'Software is updated'
WHEN version < '$$Version$$' THEN 'Software is outdated'
END AS Status
FROM programs WHERE name = '$$Name$$'