You can try this
DECLARE @Table TABLE(
Val INT
)
INSERT INTO @Table SELECT 3
INSERT INTO @Table SELECT 30
DECLARE @NumberPrefix INT
SET @NumberPrefix = 2
SELECT REPLICATE('0', @NumberPrefix - LEN(Val)) + CAST(Val AS VARCHAR(10))
FROM @Table