sql server – Hard defining decimal places

I’d like to read a table column for decimal places, and apply that decimal to an output (regardless of trailing 0s). Is there a way to do that within SQL?

The loose table is what I have here. I was able to find some examples that included hard defining the decimals, but I’m wondering if I could do so dynamically based upon the related data.

enter image description here