Padding numbers with leading zeros in Microsoft SQL Server
If you want to pad numeric values with leading zeros use the following line.
Change the number “3” to the length of the string you need.
SELECT REPLICATE('0', 3 - LEN(numeric_field)) + CAST(numeric_field as varchar)