SQL is going to do string comparison because you have strings. What you're asking for is integral comparison against 4 different version #s. The only way to do this in SQL is to pick the string apart and compare the values separately as string comparison will never work properly based upon character ordinals.
You didn't specify what version of SQL you're using so your options are limited to what SQL supports. If you're using SQL 2017+ then it has the necessary string functions to do what you want relatively cleanly. Basically you need to split the string on the dots, convert the string tokens to numbers that are padded longer than any reasonable value (version #s are 64K values generally) and then put them back together.
SELECT STRING_AGG(FORMAT(CONVERT(INT, value), '000000'), '.') FROM STRING_SPLIT(@version, '.')
The resulting string is now something like 000008.000000.000730.000000
. However now when you do an ordinal comparison of, say, 000730
and 002020
then the values will compare properly.
If you are running SQL 2016 or older then STRING_AGG
is not available and you'll have to revert to an old school approach to get it to work. Here's one discussion on the old forums on how you might do it.