• Sadly the procedure is broken.

    a) It does not correctly respect the schema specified in the call when not dbo, thus crashing

    b) It does not respect computed columns in the partitioned table

    There are probably other things broken, but 2 bugs in my testing is enough to throw it back to the author.

    That being said, this is precisely why explicit partition truncation should be part of the DDL as it is in Oracle and others.