...and mIRC offers no way to safely generate variable names.
Since the variable is unloaded as soon as you call the identifier, just give the variable a messy name, eg:
strcpy(data,"set %__dllname__functionname_1032842 x,y,z");
It's unlikely a name like that will be in use, you could also make a mIRC identifier to return a free variable name:
alias freevar {
var %r = $rand(9999,9999999999)
while ($var($eval(%r,2),1)) { %r = $rand(9999,9999999999) }
return %r
}