I show you the conclusion after many headaches and tests.
If we execute the following script in any SSMS session under SQL Server 2012 (also tested in 2017):
DECLARE @g geography;
DECLARE @h geography;
SET @g = geography::STPolyFromText('POLYGON ((-2.2141931466053393 36.848142880725426, -2.1632066297350296 36.864255247830073, 3.0526676842932088 39.266689645726004, 3.168352172454167 39.329935703712941, 3.2286305251469463 39.370418565526464, 3.2322979289615716 39.374091534163213, 3.2372882795963895 39.379457236292687, 3.2583498367577581 39.409984643625563, 3.3506438583660594 39.556107032723332, 3.4300534340816529 39.699235599046659, 3.2674327158297669 42.289964571287427, 3.1599698848294775 42.435144600606137, 0.79329389164208441 42.99441296630598, -7.6685442882152826 43.77780739075277, -8.0476876236197672 43.711457921649725, -9.2115225666636089 43.160194190763086, -9.2984566034556444 43.054102468725411, -9.2715498704469024 42.881894543711283, -7.5169998811285126 37.556527784974641, -7.4389506340710883 37.345028476444256, -7.4300533647696216 37.33933723597093, -7.426814647077407 37.337972629773219, -7.4171018386796526 37.336039770123939, -7.36341431379385 37.33029040340196, -4.5559445740609537 37.01597060730704, -2.2141931466053393 36.848142880725426))', 4326);
SET @h = geography::STPointFromText('POINT (-5.7805724666961673 43.604738856455796)', 4326);
select @g.STIntersects(@h)
We obtain the result 1. Which means that the geometries intersect. Which is not true and you can see clearly if we represent the geometries in GIS tools, such as ArcMap, QGIS or visualize in sites like https://clydedacruz.github.io/openstreetmap-wkt-playground/.
This does not happen only with that point, they can test with others such as the following:
POINT (-5.7808907869201684 43.607612302768608)
POINT (-5.7867532730156022 43.607109291914668)
POINT (-5.7910420343533673 43.607409757130171)
POINT (-5.7962209295114038 43.605527381457819)
POINT (-5.8379991303640395 43.609944466702757)
POINT (-5.8372379698022909 43.613519832305009)
POINT (-5.8339925740272829 43.616976768767834)
POINT (-5.832657139630153 43.620206197447274)
POINT (-5.827899502105284 43.624465756821465)
POINT (-5.8230287455979495 43.6276474699738)
Clarify that it is not a problem of orientation of the ring. Other interior points appear as intersecting.
I have not found an explanation, just a possibility of a bug in SQL server. This makes me very distrustful of the STIntersects () function that I use in countless places in my code.
I would appreciate any response.