I was having issues displaying polygons stored in SQL Server Express locally within a QGIS 3.28 project.
After having quizzed unsuccessfully GPT 4.0 I found the answer on good old Stack Overflow.
As part of your SQL Server Express installation you should have installed SQL Server Configuration Manager. Open this administration package and navigate to your instance to show the following;
Make sure both Named Pipes and TCP/IP are enabled.
That fixed it for me
Important note the host connection string IS case sensitive and sometimes when you use the properties from within SSMS to look at the hostname it capitalise things so watch out! That caught me out for half an hour!!
And here is my definition of the geometry table
CREATE TABLE [dbo].[geometry_columns]( [pkid] [int] IDENTITY(1,1) NOT NULL, [f_table_catalog] [varchar](50) NULL, [f_table_schema] [varchar](50) NULL, [f_table_name] [varchar](100) NULL, [f_geometry_column] [varchar](50) NULL, [coord_dimension] [int] NULL, [srid] [int] NULL, [geometry_type] [varchar](50) NULL, PRIMARY KEY CLUSTERED ( [pkid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO