The -var switch value of the preprocessor variable you want to use "$(<var|env>.MyVar)". Renaming this value will not impact dynamically created identifiers.</var|env>
heat.exe dir C:\MyDir -srd -sfrag -var var.MyVar
<wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<fragment>
<directoryref id="user-content-TARGETDIR">
<directory id="user-content-dir090ACB8E8D9B8C1F26DE6E8300AA9049" name="one">
<component id="user-content-cmpE21824A6879A478E4A884BA6B00C33C9" ...="">
<file id="user-content-filF1BA1271365EB2A130AA3F0BE83E9D6D" source="$(var.MyVar)\one\test.txt" ...="">
</file></component>
</directory></directoryref></fragment></wix>