Fixing SQL generation for queries selecting COUNT(DISTINCT...) w/ ORDER_BY

Issue #306, and PR #329 broke compatibility with a couple of queries we were using.  Two regressions were introduced.

First, if the `COUNT(DISTINCT)` had an alias applied to it, the alias would be used in the `PARTITION BY` value expression, which was invalid SQL, [according to the Transact-SQL docs](http://msdn.microsoft.com/en-us/library/ms189461.aspx) it cannot use aliases.

Second, if the query itself used a `select` call like this:
> Model.select('something as x, something_else as y')

the outer select would lose some of the aliased columns due to the regex used when stripping out the aliases into `select_frags`.

Added a test to verify this, the issues are intertwined so it's just one test.

Thanks for the great gem!