Please try the following:
SQL
DECLARE @dbconn varchar (500)
, @init_catalog VARCHAR(100)
, @db_name VARCHAR(100)
, @separator CHAR(1) = ';'
, @separator2 CHAR(1) = '=';
SET @dbconn = 'Data Source=test-sql01d\NEW_NIDEV01;Initial Catalog=Restricted;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=false;';
SET @init_catalog = TRY_CAST('<root><r>' +
REPLACE(@dbconn, @separator, '</r><r>') +
'</r></root>' AS XML).value('(/root/r[contains(./text()[1], "Initial Catalog")])[1]','VARCHAR(100)');
SELECT @init_catalog AS initial_catalog;
SET @db_name = TRY_CAST('<root><r>' +
REPLACE(@init_catalog, @separator2, '</r><r>') +
'</r></root>' AS XML).value('(/root/r/text())[2]','VARCHAR(100)');
SELECT @db_name AS [db_name];
Output
+------------+
| db_name |
+------------+
| Restricted |
+------------+