In the SQL Server 2012 there is methods to validate geography \'.IsValidDetailed()\' and to change orientation \'.ReorientObject (geography)\'.
I am working with SQ
This is working for me on SQL Server 2008. After loading the shape as a geometry, use MakeValid() to correct it, then reload into a geography.
declare @gt nvarchar(max)
declare @gm geometry
declare @gmvalid geometry
set @gmvalid = @gm.MakeValid()
set @gt = @gmvalid.STAsText()
--select @gt
if LEFT(@gt,7 ) = 'POLYGON'
begin
set @gg = geography::STPolyFromText(@gt, 4326)
end
else
begin
set @gg = geography::STMPolyFromText(@gt, 4326)
end