Hi I just tried this usefull function unter SQL 2014.
In order to maked it run again i needed to replace
permissions(id)
with
(SELECT COUNT(*) FROM fn_my_permissions(id, 'DATABASE'))
because permissions is marked as "will be removed in future versions"
But now script works great again.
Thank You very much for Your work.