Point to exact variable value

Hi there!
Please help me to solve the problem with the values mapping.

I’ve created a variable $services with type Query and get data from database that looks like this:

SELECT [ServiceName] AS __text, [ServiceId] AS __value 
FROM [Services]

The result is something like:

__text    | __value
backend   | a1s1d1f1
frontend  | q2w2e2r2
proxy     | z3x3c3v3

And now when I select needed service I get corresponding value by query like this:

It’s OK. But how can I point to exact value in query without selecting it in dropdown menu?
For example:

I have more than 250 services and don’t want to use their ids which are too long. Instead I want to use service name which are short and useful. Is there any possibility to do this?

Maybe I can use another approach setting each service name as a separate variable.
So I will get a set of variables:
$backend = a1s1d1f1
$frontend = q2w2e2r2
$proxy = z3x3c3v3

But how can I do it by query and not manually?