You have nothing in each row that associates a particular Role_ID with a particular Resource_ID, nor do you have anything that suggests a specific order to the rows, so you are going to fail here.
You need to change your table schema. One idea would be to add an IDENTITY column that is automatically incremented as you add new rows. You would need to be very careful that you add rows in the correct sequence of
Role_ID
then
Resource_ID
then
Role_ID
etc
E.g.
declare @test table (
id int identity(1,1),
fieldname varchar(50),
auditnewvalue int)
insert into @test (fieldname,auditnewvalue) values
('Role_ID',34),
('Resource_ID', 744137),
('Role_ID',5),
('Resource_ID', 974617)
Now you have something to define the correct order you can do something like
SELECT auditnewvalue AS Role_ID, Resource_ID
FROM
(
select fieldname, auditnewvalue, LEAD(auditnewvalue,1) OVER (ORDER BY ID) as Resource_ID
from @test
) as x
WHERE fieldname = 'Role_ID'
From the naming of the columns however, it looks like you would not be able to control the order in which rows are added (it looks like an audit table and you cannot really constrain the order in which things are updated). In that instance you should include a column in your table that in some way associates each update e.g. the Id of the original record.
Compare the code above with this
declare @test2 table (idOfOriginal int, fieldname varchar(50), auditnewvalue int)
insert into @test2 (idOfOriginal, fieldname,auditnewvalue) values
(2,'Role_ID',5),
(1,'Role_ID',34),
(1,'Resource_ID', 744137),
(2,'Resource_ID', 974617)
SELECT auditnewvalue AS Role_ID, Resource_ID
FROM
(
select fieldname, auditnewvalue, LEAD(auditnewvalue,1) OVER (ORDER BY idOfOriginal, fieldname) as Resource_ID
from @test2
) as x
WHERE fieldname = 'Resource_ID'