SQL Script to find all Child table upto Nth Level in SQL Server

I found out this using CTE(Common Table Expression). May not be the best but might help guess. Say there is a MasterTable A and its has three child Tables B C D. Now again these Childtable may act as Master to Someother Child Tables say B1 B2 C1 C2 D1 D1 where B1 B2 are child tables of B and So on.

In this this Script will provide you the Hirearchy Level as well.