Left-padding a column

I have had many situations where there needs to be a left padded column in sql. Usually it's a number that needs to have pre-pended 0s. Here is a very simple way. I will list the formula and then give an example:

select right('<X>0'+cast(@var as varchar(X)),X)

The bold sections (the and the number of 0s) need to be the same. So given the above formula, if I need a column padded out 10 places, I have 10 0s which means the max size of the field will be 10 and I need to make both Xs 10: