|what exactly you are trying to do ? and if you are querying the Service pack version then from where ?|
are you getting service pack info from registry or from systeminfo command or somwhere else?
An example would be using systeminfo command..
findstr /i /c:"OS Version:" C:\temp\sysinfo.txt
output of above would be something like below.
OS Version: 5.1.2600 Service Pack 3 Build 2600
now you can parse the output of findstr to get your exact value. Like
If servicepack value is 1 or 2 do your command.