SD card gets different name at every format Every time I format the SD card, or install new ROM., or move it to another phone, it comes with a different label

Something like
410E-1D17 or FEA7-1EF1 or BD05-14A1

How do I stop this mess and make it consistent ? 
Its screws up all apps that rely on the absolute path

Does it happen only on Xperia phones ?

Android M
No you can't stop it from changing.

First you should know it's not the "name" for an SD card (technically "volume"). Even worse, "name" is an ambiguous term here. You should either use "product name" (for hardware) or "volume name/label".

This is, in fact, "Volume Serial Number". It's a 32-bit integer so you see it represented with 8 hexadecimal numbers. It is subject to change whenever you format it.

As beeshyams noted, you may be able change it with command line utilities from rooted Android (you can always do so in a GNU/Linux system). To obtain the correct utilities, you should download Termux, and install a package named mtools in it:

apt install mtools tsu


Then follow this guide and run

tsu
mlabel -i /dev/block/xxx -N XXXXXXXX ::label


I haven't tested it but I'm afraid it isn't an easy job to do on Android. Better grab a Linux computer :)