I have a process that writes to a cs_process_log. It inserts a START row at the beginning of certain processes and then an END row at the end of the process. I want to match up the START with END rows to get a minutes DATEDIFF. Under certain conditions a process might insert multiple MESSAGEs between the START and END rows. I want to show these messages also and want to catch any START rows that do not have a matching END row, which would mean a failed condition.
I have played with it for awhile now. but have not been able to come up with a working solution. Any help would be appreciated.
This is the output that i am hoping to get. (it is in desc order)

drop table cs_process_log
create table cs_process_log (recid int identity, process_name varchar(max), category varchar(max), run_datetime datetime, notes varchar(max))
insert into cs_process_log
select process_name, category, run_datetime, notes from
(values
('SECURITY', 'START', '2021-08-01 14:35:39.067', ''),
('SECURITY', 'END', '2021-08-01 14:50:39.067', ''),
('DASHBOARD', 'START', '2021-08-01 15:01:39.067', ''),
('DASHBOARD', 'END', '2021-08-01 15:08:39.067', ''),
('SECURITY', 'START', '2021-08-01 16:35:39.067', ''),
('SECURITY', 'END', '2021-08-01 16:50:39.067', ''),
('DASHBOARD', 'START', '2021-08-01 17:01:39.067', ''),
('DASHBOARD', 'END', '2021-08-01 17:08:39.067', ''),
('SECURITY', 'START', '2021-08-02 14:35:39.067', ''),
('SECURITY', 'END', '2021-08-02 14:50:39.067', ''),
('DASHBOARD', 'START', '2021-08-02 15:01:39.067', ''),
('DASHBOARD', 'MIDDLE STEP2', '2021-08-02 15:03:39.067', ''),
('SECURITY', 'START', '2021-08-03 14:35:39.067', ''),
('SECURITY', 'END', '2021-08-03 14:50:39.067', ''),
('DASHBOARD', 'START', '2021-08-03 15:01:39.067', ''),
('DASHBOARD', 'MIDDLE STEP3', '2021-08-03 15:03:39.067', ''),
('DASHBOARD', 'END', '2021-08-03 15:08:39.067', ''),
('SECURITY', 'START', '2021-07-25 14:35:39.067', ''),
('SECURITY', 'END', '2021-07-25 14:50:39.067', ''),
('DASHBOARD', 'START', '2021-07-25 15:01:39.067', ''),
('DASHBOARD', 'END', '2021-07-25 15:08:39.067', ''))
a (process_name, category, run_datetime, notes)
