You can use STAsBinary() (Returns the Open Geospatial Consortium (OGC) Well-Known Binary (WKB) representation of a geometry instance.)on geometry types to convert into binary format which can be used in distinct.
You can convert back to geometry by using STGeomFromWKB.