This is not as easy as it seems in the first place. Given you spell "Name" with uppercase "N" and that "N" sorts below all lower case letters, you could try like
awk -f transp.awk file | LC_ALL=C sort | awk -f transp.awk
Name a b c d
l l4 l2 l3 l1
l1 4 2 3 1
l2 1 2 2 2
l3 2 1 2 1
You may want to add some refinements, like setting MX to the max(NF), or doing some error checking... some awk versions offer their internal sort; that might help as well...