I don't see this as "shortest path" problem. More something that we could call "all paths" - but I am not sure. Ok, T-SQL is not the language for graph algorithms, but not impossible to handle either.
This is a good article about some general graph-related problem solutions in t-sql:
http://hansolav.net/sql/graphs.html[
^]. Here is an article about the "all paths" problem:
http://www.technical-recipes.com/2011/a-recursive-algorithm-to-find-all-paths-between-two-given-nodes/[
^]. This is not t-sql, but you can understand the concept.
You could use these approaches as samples and starting point. As you can see, it is not the simplest problem. I am pretty sure you will need to use fancy things like temporary tables and cursors.