• Lowell, that's a neat trick!

    Next step would be some refinement to return the actual SQL needed, ready for cut & paste. This sort of thing (borrowing your code):

    IF OBJECT_ID('tempdb..#temp', 'U') IS NOT NULL

    DROP TABLE #temp;

    SELECT TOP 3

    *

    INTO #temp

    FROM sys.objects;

    --use this to build the resultset actual datatype/size

    SELECT

    colz.name

    , colz.column_id

    , TYPE_NAME(colz.user_type_id)

    , colz.max_length

    , colz.precision

    , colz.scale

    , script = CONCAT('[', colz.name, '] ', TYPE_NAME(colz.user_type_id), lth.Lth,',')

    FROM

    tempdb.sys.columns colz

    CROSS APPLY

    (

    SELECT Lth = (CASE

    WHEN TYPE_NAME(colz.user_type_id) IN ('char', 'varchar', 'nchar', 'nvarchar') THEN

    CONCAT('(', CAST(colz.max_length AS VARCHAR(4)),')')

    ELSE

    ''

    END

    )

    ) lth

    WHERE colz.object_id = OBJECT_ID('tempdb.dbo.#temp')

    ORDER BY colz.column_id;

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.