• Because you are passing the telephone number in as an int, so it drops the leading zero, and you should pass a string in as a string

    select

    [dbo].[fnFormatMobileNumber]('0842507889')